class Solution:
    def maxResult(self, nums, k: int) -> int:
        if len(nums)==1:
            return nums[0]
        nums[1]+=nums[0]
        queue=[]
        for i in range(2,len(nums)):
            nums[i]+=max(nums[max(0,i-k):i])
        print(nums)
        return nums[-1]

s=Solution()